package org.zhu.common.bean;

import java.io.Serializable;

/**
 * Created by zhu yingzhi on 2017/9/21.
 * @author yingzhi zhu
 * 用户实体类
 */
public class User implements Serializable{
    /**
     * 自增
     */
    private Long id;
    /**
     * 微信openid
     */
    private String openid;
    /**
     * 昵称
     */
    private String nickName; 
    /**
     * 头像
     */
    private String avatarUrl;
    /**
     * 性别
     */
    private String gender;
    /**
     * 省
     */
    private String province;
    /**
     * 市
     */
    private String city;
    /**
     * 国家
     */
    private String country;
    /**
     * 用户sessionkey
     */
    private String sessionKey;
    /**
     * 用户添加时间
     */
    private String add_time;
    /**
     * 电话
     */
    private String phone;
    /**
     * 邮箱
     */
    private String mail;

    public User() {
    }

    public void registUser(User user) {
        this.openid = user.getOpenid();
        this.sessionKey = user.getSessionKey();
    }

    public User(String openid, String sessionKey) {
        this.openid = openid;
        this.sessionKey = sessionKey;
    }


    public String getAdd_time() {
        if (add_time!=null && add_time.contains(".0")){
            add_time = add_time.substring(0,add_time.length()-2);
        }
        return add_time;
    }

    public void setAdd_time(String add_time) {
        this.add_time = add_time;
    }

    public String getSessionKey() {
        return sessionKey;
    }

    public void setSessionKey(String sessionKey) {
        this.sessionKey = sessionKey;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getOpenid() {
        return openid;
    }

    public void setOpenid(String openid) {
        this.openid = openid;
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    public String getAvatarUrl() {
        return avatarUrl;
    }

    public void setAvatarUrl(String avatarUrl) {
        this.avatarUrl = avatarUrl;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public String getProvince() {
        return province;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getCountry() {
        return country;
    }

    public void setCountry(String country) {
        this.country = country;
    }
}

